home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Surfer 2.0
/
Internet Surfer 2.0 (Wayzata Technology) (1996).iso
/
pc
/
text
/
mac
/
faqs.453
< prev
next >
Wrap
Text File
|
1996-02-12
|
29KB
|
827 lines
Frequently Asked Questions (FAQS);faqs.453
What day of the week was the second visit?
From "Mathematical Diversions" by Hunter + Madachy
==> arithmetic/clock/day.of.week.s <==
The answer is 17 days and 3 hours later, which would have been a Wednesday.
This is the only other time in the same month when the two would agree at all.
In 17 days the slow clock loses 17*24*7 minutes = 2856 minutes,
or 47 hours and 36 minutes. In 3 hours more it loses 21 minutes, so
it has lost a total of 47 hours and 57 minutes. Modulo 12 hours, it
has *gained* 3 minutes so as to make up the 3 minutes it was slow on
Sunday. It is now (fortnight plus 3 days) exactly accurate.
==> arithmetic/clock/thirds.p <==
Do the 3 hands on a clock ever divide the face of the clock into 3
equal segments, i.e. 120 degrees between each hand?
==> arithmetic/clock/thirds.s <==
First let us assume that our clock has 60 divisions. We will show that
any time the hour hand and the minute hand are 20 divisions (120 degrees)
apart, the second hand cannot be an integral number of divisions from the
other hands, unless it is straight up (on the minute).
Let us use h for hours, m for minutes, and s for seconds.
We will use =n to mean congruent mod n, thus 12 =5 7.
We know that m =60 12h, that is, the minute hand moves 12 times as fast
as the hour hand, and wraps around at 60.
We also have s =60 60m. This simplifies to s/60 =1 m, which goes to
s/60 = frac(m) (assuming s is in the range 0 <= s < 60), which goes to
s = 60 frac(m). Thus, if m is 5.5, s is 30.
Now let us assume the minute hand is 20 divisions ahead of the hour hand.
So m =60 h + 20, thus 12h =60 h + 20, 11h =60 20, and, finally,
h =60/11 20/11 (read 'h is congruent mod 60/11 to 20/11').
So all values of m are k + n/11 for some integral k and integral n,
0 <= n < 11. s is therefore 60n/11. If s is to be an integral number of
units from m and h, we must have 60n =11 n. But 60 and 11 are relatively
prime, so this holds only for n = 0. But if n = 0, m is integral, so
s is 0.
Now assume, instead, that the minute hand is 20 divisions behind the hour hand.
So m =60 h - 20, 12h =60 h - 20, 11h =60 -20, h =60/11 -20/11.
So m is still k + n/11. Thus s must be 0.
But if s is 0, h must be 20 or 40. But this translates to 4 o'clock or
8 o'clock, at both of which the minute hand is at 0, along with the second
hand.
Thus the 3 hands can never be 120 degrees apart, Q.E.D.
==> arithmetic/consecutive.product.p <==
Prove that the product of three or more consecutive natural numbers cannot be a
perfect square.
==> arithmetic/consecutive.product.s <==
Three consecutive numbers:
If a and b are relatively prime, and ab is a square,
then a and b are squares. (This is left as an exercise.)
Suppose (n - 1)n(n + 1) = k^2, where n > 1.
Then n(n^2 - 1) = k^2. But n and (n^2 - 1) are relatively prime.
Therefore n^2 - 1 is a perfect square, which is a contradiction.
Four consecutive numbers:
n(n + 1)(n + 2)(n + 3) = (n^2 + 3n + 1)^2 - 1
Five consecutive numbers:
Assume the product is a integer square, call it m.
The prime factorization of m must have even numbers of each prime factor.
For each prime factor, p, of m, p >= 5, p^2k must divide one of the
consecutive naturals in the product. (Otherwise, the difference between two
of the naturals in the product would be a positive multiple of a prime >= 5.
But in this problem, the greatest difference is 4.) So we need only consider
the primes 2 and 3.
Each of the consecutive naturals is one of:
1) a perfect square
2) 2 times a perfect square
3) 3 times a perfect square
4) 6 times a perfect square.
By the shoe box principle, two of the five consecutive numbers must fall into
the same category.
If there are two perfect squares, then their difference being less than five
limits their values to be 1 and 4. (0 is not a natural number, so 0 and 1
and 0 and 4 cannot be the perfect squares.) But 1*2*3*4*5=120!=x*x where x
is an integer.
If there are two numbers that are 2 times a perfect square, then their
difference being less than five implies that the perfect squares (which are
multiplied by 2) are less than 3 apart, and no two natural squares differ by
only 1 or 2.
A similar argument holds for two numbers which are 3 times a perfect square.
We cannot have the case that two of the 5 consecutive numbers are multiples
(much less square multiples) of 6, since their difference would be >= 6, and
our span of five consecutive numbers is only 4.
Therefore the assumption that m is a perfect square does not hold.
QED.
In general the equation:
y^2 = x(x+1)(x+2)...(x+n), n > 3
has only the solution corresponding to y = 0.
This is a theorem of Rigge [O. Rigge, ``Uber ein diophantisches Problem'',
IX Skan. Math. Kong. Helsingfors (1938)] and Erdos [P. Erdos, ``Note on
products of consecutive integers,'' J. London Math. Soc. #14 (1939),
pages 194-198].
A proof can be found on page 276 of [L. Mordell, ``Diophantine
Equations'', Academic Press 1969].
==> arithmetic/consecutive.sums.p <==
Find all series of consecutive positive integers whose sum is exactly 10,000.
==> arithmetic/consecutive.sums.s <==
Generalize to find X (and I) such that
(X + X+1 + X+2 + ... + X+I) = T
for any integer T.
You are asking for all (X,I) s.t. (2X+I)(I+1) = 2T. The problem is
(very) slightly easier if we don't restrict X to being positive, so
we'll solve this first.
Note that 2X+I and I+1 must have different parities, so the answer
to the relaxed question is N = 2*(o_1+1)*(o_2+1)*...*(o_n+1), where
2T = 2^o_0*3^o_1*...*p_n^o_n (the prime factorization); this is easily
seen to be the number of ways we can break 2T up into two positive
factors of differing parity (with order).
In particular, 20000 = 2^5*5^4, hence there are 2*(4+1) = 10 solutions
for T = 10000. These are (2X+I,I+1):
(32*1,5^4) (32*5,5^3) (32*5^2,5^2) (32*5^3,5) (32*5^4,1)
(5^4,32*1) (5^3,32*5) (5^2,32*5^2) (5,32*5^3) (1,32*5^4)
And they give rise to the solutions (X,I):
(-296,624) (28,124) (388,24) (1998,4) (10000,0)
(297,31) (-27,179) (-387,799) (-1997,3999) (-9999,19999)
If you require that X>0 note that this is true iff 2X+I > I+1 and
hence the number of solutions to this problem is N/2 (due to the
symmetry of the above ordered pairs).
==> arithmetic/digits/all.ones.p <==
Prove that some multiple of any integer ending in 3 contains all 1s.
==> arithmetic/digits/all.ones.s <==
Let n be our integer; one such desired multiple is then
( 10^(phi(n))-1 )/9. All we need is that (n,10) = 1, and
if the last digit is 3 this must be the case. A different
proof using the pigeonhole principle is to consider the sequence
1, 11, 111, ..., (10^n - 1)/9. By previous reasoning we must
have at some point that either some member of our sequence = 0 (mod n)
or else some value (mod n) is duplicated. Assume the latter, with
x_a and x_b, x_b>x_a, possesing the duplicated remainders. We then
have that x_b - x-a = 0 (mod n). Let m be the highest power of 10
dividing x_b - x_a. Now since (10,n) = 1, we can divide by 10^m and
get that (x_b - x_a)/10^m = 0 (n). But (x_b - x_a)/10^m is a number
containing only the digit 1.
Q.E.D.
==> arithmetic/digits/arabian.p <==
What is the Arabian Nights factorial, the number x such that x! has 1001
digits? How about the prime x such that x! has exactly 1001 zeroes on
the tail end. (Bonus question, what is the 'rightmost' non-zero digit in x!?)
==> arithmetic/digits/arabian.s <==
The first answer is 450!.
Determining the number of zeroes at the end of x! is relatively easy once
you realize that each such zero comes from a factor of 10 in the product
1 * 2 * 3 * ... * x
Each factor of 10, in turn, comes from a factor of 5 and a factor of 2.
Since there are many more factors of 2 than factors of 5, the number of 5s
determines the number of zeroes at the end of the factorial.
The number of 5s in the set of numbers 1 .. x (and therefore the number
of zeroes at the end of x!) is:
z(x) = int(x/5) + int(x/25) + int(x/125) + int(x/625) + ...
This series terminates when the powers of 5 exceed x.
I know of no simple way to invert the above formula (i.e., to find x for
a given z(x)), but I can approximate it by noting that, except for the "int"
function,
5*z(x) - x = z(x)
which gives:
x = 4*z(x) (approximately).
The given problem asked, "For what prime x is z(x)=1001". By the above forumla,
this is approximately 4*1001=4004. However, 4004! has only
800 + 160 + 32 + 6 + 1 = 999 zeroes at the end of it.
The numbers 4005! through 4009! all have 1000 zeroes at their end and
the numbers 4010! through 4014! all have 1001 zeroes at their end.
Since the problem asked for a prime x, and 4011 = 3*7*191, the only solution
is x=4013.
The problem of determining the rightmost nonzero digit in x! is somewhat more
difficult. If we took the numbers 1, 2, ... , x and removed all factors of 5
(and an equal number of factors of 2), the remaining numbers multiplied
together modulo 10 would be the answer. Note that since there are still many
factors of 2 left, the rightmost nonzero digit must be 2, 4, 6, or 8 (x > 1).
Letting r(x) be the rightmost nonzero digit in x!, an expression for r(x) is:
r(x) = (r(int(x/5)) * w * r(x mod 10)) mod 10, x >= 10.
where w is 4 if int(x/10) is odd and 6 if it is even.
The values of r(x) for 0 <= x <= 9 are 1, 1, 2, 6, 4, 2, 2, 4, 2, and 8.
The way to see this is true is to take the numbers 1, 2, ..., x in groups
of 10. In each group, remove 2 factors of 10. For example, from the
set 1, 2, ..., 10, choose a factor of 2 from 2 and 6 and a factor of 5 from
5 and 10. This leaves 1, 1, 3, 4, 1, 3, 7, 8, 9, 2. Next, separate all the
factors that came from multiples of 5. The rightmost nonzero digit of x!
can now (hopefully) be seen to be:
r(x) = (r(int(x/5)) * w * r(x mod 10)) mod 10
where w is the rightmost digit in the number formed by multiplying the numbers
1, 2, 3, ..., 10*int(x/10) after the factors of 10 and the factors left over
by the multiples of 5 have been removed. In the example with x = 10, this
would be (1 * 1 * 3 * 4 * 3 * 7 * 8 * 9) mod 10 = 4. The "r(x mod 10)" term
takes care of the numbers from 10*int(x/10)+1 up to x.
The "w" term can be seen to be 4 or 6 depending on whether int(x/10) is odd or
even since, after removing 10*n+5 and 10*n+10 and a factor of 2 each from
10*n+2 and 10*n+6 from the group of numbers 10*n+1 through 10*n+10, the
remaining factors (mod 10) always equals 4 and 4^t mod 10 = 4 if t is odd and
6 when t is even (t != 0).
So, finally, the rightmost nonzero digit in 4013! is found as follows:
r(4013) = (r(802) * 4 * 6) mod 10
r(802) = (r(160) * 6 * 2) mod 10
r(160) = (r(32) * 6 * 1) mod 10
r(32) = (r(6) * 4 * 2) mod 10
Using a table of r(x) for 0 <= x <= 9, r(6) = 2. Then,
r(32) = (2 * 4 * 2) mod 10 = 6
r(160) = (6 * 6 * 1) mod 10 = 6
r(802) = (6 * 6 * 2) mod 10 = 2
r(4013) = (2 * 4 * 6) mod 10 = 8
Thus, the rightmost nonzero digit in 4013! is 8.
==> arithmetic/digits/circular.p <==
What 6 digit number, with 6 different digits, when multiplied by all integers
up to 6, circulates its digits through all 6 possible positions, as follows:
ABCDEF * 1 = ABCDEF
ABCDEF * 3 = BCDEFA
ABCDEF * 2 = CDEFAB
ABCDEF * 6 = DEFABC
ABCDEF * 4 = EFABCD
ABCDEF * 5 = FABCDE
==> arithmetic/digits/circular.s <==
ABCDEF=142857 (the digits of the expansion of 1/7).
==> arithmetic/digits/divisible.p <==
Find the least number using 0-9 exactly once that is evenly divisible by each
of these digits?
==> arithmetic/digits/divisible.s <==
Since the sum of the digits is 45, any permutation of the digits gives a
multiple of 9. To get a multiple of both 2 and 5, the last digit must
be 0, and thus to get a multiple of 8 (and 4), the tens digit must be
even, and the hundreds digit must be odd if the tens digit is 2 or 6,
and even otherwise. The number will also be divisible by 6, since it is
divisible by 2 and 3, so 7 is all we need to check. First, we will look
for a number whose first five digits are 12345; now, 1234500000 has a
remainder of 6 when divided by 7, so we have to arrange the remaining
digits to get a remainder of 1. The possible arrangements, in
increasing order, are
78960, remainder 0
79680, remainder 6
87960, remainder 5
89760, remainder 6
97680, remainder 2
98760, remainder 4
That didn't work, so try numbers starting with 12346; this is impossible
because the tens digit must be 8, and the hundreds digit cannot be even.
Now try 12347, and 1234700000 has remainder 2. The last five digits can
be
58960, remainder 6
59680, remainder 5, so this works, and the number is
1234759680.
==> arithmetic/digits/equations/123456789.p <==
In how many ways can "." be replaced with "+", "-", or "" (concatenate) in
.1.2.3.4.5.6.7.8.9=1 to form a correct equation?
==> arithmetic/digits/equations/123456789.s <==
1-2 3+4 5+6 7-8 9 = 1
+1-2 3+4 5+6 7-8 9 = 1
1+2 3+4-5+6 7-8 9 = 1
+1+2 3+4-5+6 7-8 9 = 1
-1+2 3-4+5+6 7-8 9 = 1
1+2 3-4 5-6 7+8 9 = 1
+1+2 3-4 5-6 7+8 9 = 1
1-2 3-4+5-6 7+8 9 = 1
+1-2 3-4+5-6 7+8 9 = 1
1-2-3-4 5+6 7-8-9 = 1
+1-2-3-4 5+6 7-8-9 = 1
1+2-3 4+5 6-7-8-9 = 1
+1+2-3 4+5 6-7-8-9 = 1
-1+2 3+4+5-6-7-8-9 = 1
-1 2+3 4-5-6+7-8-9 = 1
1+2+3+4-5+6+7-8-9 = 1
+1+2+3+4-5+6+7-8-9 = 1
-1+2+3-4+5+6+7-8-9 = 1
1-2-3+4+5+6+7-8-9 = 1
+1-2-3+4+5+6+7-8-9 = 1
1+2 3+4 5-6 7+8-9 = 1
+1+2 3+4 5-6 7+8-9 = 1
1+2 3-4-5-6-7+8-9 = 1
+1+2 3-4-5-6-7+8-9 = 1
1+2+3+4+5-6-7+8-9 = 1
+1+2+3+4+5-6-7+8-9 = 1
-1+2+3+4-5+6-7+8-9 = 1
1-2+3-4+5+6-7+8-9 = 1
+1-2+3-4+5+6-7+8-9 = 1
-1-2-3+4+5+6-7+8-9 = 1
1-2+3+4-5-6+7+8-9 = 1
+1-2+3+4-5-6+7+8-9 = 1
1+2-3-4+5-6+7+8-9 = 1
+1+2-3-4+5-6+7+8-9 = 1
-1-2+3-4+5-6+7+8-9 = 1
-1+2-3-4-5+6+7+8-9 = 1
-1+2 3+4 5-6 7-8+9 = 1
1-2 3-4 5+6 7-8+9 = 1
+1-2 3-4 5+6 7-8+9 = 1
-1+2 3-4-5-6-7-8+9 = 1
-1+2+3+4+5-6-7-8+9 = 1
1-2+3+4-5+6-7-8+9 = 1
+1-2+3+4-5+6-7-8+9 = 1
1+2-3-4+5+6-7-8+9 = 1
+1+2-3-4+5+6-7-8+9 = 1
-1-2+3-4+5+6-7-8+9 = 1
1+2-3+4-5-6+7-8+9 = 1
+1+2-3+4-5-6+7-8+9 = 1
-1-2+3+4-5-6+7-8+9 = 1
-1+2-3-4+5-6+7-8+9 = 1
1-2-3-4-5+6+7-8+9 = 1
+1-2-3-4-5+6+7-8+9 = 1
1-2 3+4+5+6+7-8+9 = 1
+1-2 3+4+5+6+7-8+9 = 1
1+2+3+4 5-6 7+8+9 = 1
+1+2+3+4 5-6 7+8+9 = 1
1 2+3 4+5-6 7+8+9 = 1
+1 2+3 4+5-6 7+8+9 = 1
1+2+3-4-5-6-7+8+9 = 1
+1+2+3-4-5-6-7+8+9 = 1
-1+2-3+4-5-6-7+8+9 = 1
1-2-3-4+5-6-7+8+9 = 1
+1-2-3-4+5-6-7+8+9 = 1
-1-2-3-4-5+6-7+8+9 = 1
-1-2 3+4+5+6-7+8+9 = 1
1-2+3 4-5 6+7+8+9 = 1
+1-2+3 4-5 6+7+8+9 = 1
1 2-3 4+5-6+7+8+9 = 1
+1 2-3 4+5-6+7+8+9 = 1
Total solutions = 69
69/19683 = 0.35 %
for those who care (it's not very elegant but it did the trick):
#include <stdio.h>
#include <math.h>
main (argc,argv)
int argc;
char *argv[];
{
int sresult, result, operator[10],thisop;
char buf[256],ops[3];
int i,j,tot=0,temp;
ops[0] = ' ';
ops[1] = '-';
ops[2] = '+';
for (i=1; i<10; i++) operator[i] = 0;
for (j=0; j < 19683; j++) {
result = 0;
sresult = 0;
thisop = 1;
for (i=1; i<10; i++) {
switch (operator[i]) {
case 0:
sresult = sresult * 10 + i;
break;
case 1:
result = result + sresult * thisop;
sresult = i;
thisop = -1;
break;
case 2:
result = result + sresult * thisop;
sresult = i;
thisop = 1;
break;
}
}
result = result + sresult * thisop;
if (result == 1) {
tot++;
for (i=1;i<10;i++)
printf("%c%d",ops[operator[i]],i);
printf(" = %d\n",result);
}
temp = 0;
operator[1] += 1;
for (i=1;i<10;i++) {
operator[i] += temp;
if (operator[i] > 2) { operator[i] = 0; temp = 1;}
else temp = 0;
}
}
printf("Total solutions = %d\n" , tot);
}
cwren@media.mit.edu (Christopher Wren)
==> arithmetic/digits/equations/1992.p <==
1 = -1+9-9+2. Extend this list to 2 - 100 on the left side of the equals sign.
==> arithmetic/digits/equations/1992.s <==
1 = -1+9-9+2
2 = 1*9-9+2
3 = 1+9-9+2
4 = 1+9/9+2
5 = 1+9-sqrt(9)-2
6 = 1^9+sqrt(9)+2
7 = -1+sqrt(9)+sqrt(9)+2
8 = 19-9-2
9 = (1/9)*9^2
10= 1+(9+9)/2
11= 1+9+sqrt(9)-2
12= 19-9+2
13= (1+sqrt(9))!-9-2
14= 1+9+sqrt(9)!-2
15= -1+9+9-2
16= -1+9+sqrt(9)!+2
17= 1+9+9-2
18= 1+9+sqrt(9)!+2
19= -1+9+9+2
20= (19-9)*2
21= 1+9+9+2
22= (-1+sqrt(9))*(9-2)
23= (1+sqrt(9))!-sqrt(9)+2
24= -1+9*sqrt(9)-2
25= 1*9*sqrt(9)-2
26= 19+9-2
27= 1*9+9*2
28= 1+9+9*2
29= 1*9*sqrt(9)+2
30= 19+9+2
31= (1+sqrt(9))!+9-2
32= -1+sqrt(9)*(9+2)
33= 1*sqrt(9)*(9+2)
34= (-1+9+9)*2
35= -1+(9+9)*2
36= 1^9*sqrt(9)!^2
37= 19+9*2
38= 1*sqrt(9)!*sqrt(9)!+2
39= 1+sqrt(9)!*sqrt(9)!+2
40= (1+sqrt(9)!)*sqrt(9)!-2
41= -1+sqrt(9)!*(9-2)
42= (1+sqrt(9))!+9*2
43= 1+sqrt(9)!*(9-2)
44= -1+9*(sqrt(9)+2)
45= 1*9*(sqrt(9)+2)
46= 1+9*(sqrt(9)+2)
47= (-1+sqrt(9)!)*9+2
48= 1*sqrt(9)!*(sqrt(9)!+2)
49= (1+sqrt(9)!)*(9-2)
50= (-1+9)*sqrt(9)!+2
51= -1+9*sqrt(9)!-2
52= 1*9*sqrt(9)!-2
53= -1+9*sqrt(9)*2
54= 1*9*sqrt(9)*2
55= 1+9*sqrt(9)*2
56= 1*9*sqrt(9)!+2
57= 1+9*sqrt(9)!+2
58= (1+9)*sqrt(9)!-2
59= 19*sqrt(9)+2
60= (1+9)*sqrt(9)*2
61= (1+sqrt(9)!)*9-2
62= -1+9*(9-2)
63= 1*9*(9-2)
64= 1+9*(9-2)
65= (1+sqrt(9)!)*9+2
66= 1*sqrt(9)!*(9+2)
67= 1+sqrt(9)!*(9+2)
68= -(1+sqrt(9))!+92
69= (1+sqrt(9))!+(9/.2)
70= (1+9)*(9-2)
71= -1-9+9^2
72= (1+sqrt(9))*9*2
73= -19+92
74= (-1+9)*9+2
75= -1*sqrt(9)!+9^2
76= 1-sqrt(9)!+9^2
77= (1+sqrt(9)!)*(9+2)
78= -1+9*9-2
79= 1*9*9-2
80= 1+9*9-2
81= 1*9*sqrt(9)^2
82= -1+9*9+2
83= 1*9*9+2
84= 1+9*9+2
85= -1-sqrt(9)!+92
86= -1*sqrt(9)!+92
87= 1-sqrt(9)!+92
88= (1+9)*9-2
89= -1*sqrt(9)+92
90= 1-sqrt(9)+92
91= -1^9+92
92= (1+9)*9+2
93= 1^9+92
94= -1+sqrt(9)+92
95= 19*(sqrt(9)+2)
96= -1+99-2
97= 1*99-2
98= 1+99-2
99= 1*9*(9+2)
100= -1+99+2
==> arithmetic/digits/equations/383.p <==
Make 383 out of 1,2,25,50,75,100 using +,-,*,/.
==> arithmetic/digits/equations/383.s <==
You can get 383 with ((2+50)/25+1)*100+75.
Of course, if you expect / as in C, the above expression is just 375.
But then you can get 383 with (25*50-100)/(1+2). Pity there's no way
to use the 75.
If we had a language that rounded instead of truncating, we could use
((1+75+100)*50)/(25-2) or (2*75*(25+100))/(50-1).
I imagine your problem lies in not dividing things that aren't
divisible.
Dan Hoey
Hoey@AIC.NRL.Navy.Mil
==> arithmetic/digits/extreme.products.p <==
What are the extremal products of three three-digit numbers using digits 1-9?
==> arithmetic/digits/extreme.products.s <==
There is a simple procedure which applies to these types of problems (and
which can be proven with help from the arithmetic-geometric inequality).
For the first part we use the "first large then equal" procedure.
This means that are three numbers will be 7**, 8**, and 9**. Now
the digits 4,5,6 get distributed so as to make our three number as
close to each other as possible, i.e. 76*, 85*, 94*. The same goes
for the remaining three digits, and we get 763, 852, 941.
For the second part we use the "first small then different" procedure.
Our three numbers will be of the form 1**, 2**, 3**. We now place
the three digits so as to make our three numbers as unequal as possible;
this gives 14*, 25*, 36*. Finishing, we get 147, 258, 369.
Now, *prove* that these procedures work for generalizations of this
problem.
==> arithmetic/digits/googol.p <==
What digits does googol! start with?
==> arithmetic/digits/googol.s <==
I'm not sure how to calculate the first googol of digits of log10(e), but
here's the first 150(approximately) of them...
0.43429448190325182765112891891660508229439700580366656611445378316586464920
8870774729224949338431748318706106744766303733641679287158963906569221064663
We need to deal with the digits immediately after the decimal point in
googol*log10(e), which are .187061
frac[log(googol!)] = frac[halflog2pi + 50 + googol(100-log10(e))]
= frac{halflog2pi + frac[googol(100-log10(e))]}
= frac[.399090 + (1- .187061)]
= .212029
10 ** .212029 = 1.629405
Which means that googol! starts with 1629
==> arithmetic/digits/labels.p <==
You have an arbitrary number of model kits (which you assemble for
fun and profit). Each kit comes with twenty (20) stickers, two of which
are labeled "0", two are labeled "1", ..., two are labeled "9".
You decide to stick a serial number on each model you assemble starting
with one. What is the first number you cannot stick. You may stockpile
unused numbers on already assembled models, but you may not crack open
a new model to get at its stickers. You complete assembling the current
model before starting the next.
==> arithmetic/digits/labels.s <==
The method I used for this problem involved first coming up with a
formula that says how many times a digit has been used in all n models.
n = k*10^i + m for some k,m with 0 <k <10, m < 10^i
f(d,n) = (number of d's used getting to k*10^i from digits 0 to (i-1)) +
(number of d's used by #'s 10^i to n from digit i) + f(d,m)
f(d,n) = i*k*10^(i-1) + (if (d < k) 10^i else if (d == k) m+1 else 0) + f(d,m)
This doesn't count 0's, which should be ok as they are not used as often
as other digits. From the formula, it is clear that f(1,n) is never
less than f(d,n) for 1<d<10.
So I just calculated f(1,n) for various n (with some help from bc).
I quickly discovered that for n = 2*10^15, f(1,n) = 2*n. After further
trials I determined that for n = 1999919999999981, f(1,n) = 2*n + 1.
This appears to be the smallest n with f(1,n) > 2*n.
==> arithmetic/digits/nine.digits.p <==
Form a number using 0-9 once with its first n digits divisible by n.
==> arithmetic/digits/nine.digits.s <==
First, reduce the sample set. For each digit of ABCDEFGHI, such that the last
digit, (current digit), is the same as a multiple of N :
A: Any number 1-9
B: Even numbers 2,4,6,8 (divisible by 2).
C: Any number 1-9 (21,12,3,24,15,6,27,18,9).
D: Even numbers 2,4,6,8 (divisible by 4, every other even).
E: 5 (divisible by 5 and 0 not allowed).
F: Even numbers (12,24,6,18)
G: Any number 1-9 (21,42,63,14,35,56,7,28,49).
H: Even numbers (32,24,16,8)
I: Any number 1-9 (81,72,63,54,45,36,27,18,9)
Since E must be 5, I can eliminate it everywhere else.
Since I will use up all the even digits, (2,4,6,8) filling in those spots
that must be even. Any number becomes all odds, except 5.
A: 1,3,7,9
B: 2,4,6,8
C: 1,3,7,9
D: 2,4,6,8
E: 5
F: 2,4,6,8
G: 1,3,7,9
H: 2,4,6,8
I: 1,3,7,9
We have that 2C+D=0 (mod 4), and since C is odd,
this implies that D is 2 or 6; similarly we find that H is 2 or 6 ==>
{B,F} = {4,8}. D+5+F=0 (mod 3) ==> if D=2 then F=8, if D=6 then F=4.
We have two cases.
Assume our number is of the form A4C258G6I0. Now the case n=8 ==>
G=1,9; case n=3 ==> A+1+C=0 (mod 3) ==> {A,C}={1,7} ==> G=9, I=3.
The two numbers remaining fail for n=7.
Assume our number is of the form A8C654G2I0. The case n=8 ==> G=3,7.
If G=3, we need to check to see which of 1896543, 9816543, 7896543,
and 9876543 are divisible by 7; none are.
If G=7, we need to check to see which of 1896547, 9816547, 1836547,
and 3816547 are divisible by 7; only the last one is, which yields
the solution 3816547290.
==> arithmetic/digits/palindrome.p <==
Does the series formed by adding a number to its reversal always end in
a palindrome?
==> arithmetic/digits/palindrome.s <==
This is not known.
If you start with 196, after 9480000 iterations you get a 3924257-digit
non-palindromic number. However, there is no known proof that you will
never get a palindrome.
The statement is provably false for binary numbers. Roland Sprague has
shown that 10110 starts a series that never goes palindromic.
==> arithmetic/digits/palintiples.p <==
Find all numbers that are multiples of their reversals.
==> arithmetic/digits/palintiples.s <==
We are asked to find numbers that are integer multiples of their
reversals, which I call palintiples. Of course, all the palindromic
numbers are a trivial example, but if we disregard the unit multiples,
the field is narrowed considerably.
Rouse Ball (_Mathematical_recreations_and_essays_) originated the
problem, and G. H. Hardy (_A_mathematician's_apology_) used the result
that 9801 and 8712 are the only four-digit palintiples as an example
of a theorem that is not ``serious''. Martin Beech (_The_mathema-
tical_gazette_, Vol 74, #467, pp 50-51, March '90) observed that
989*01 and 879*12 are palintiples, an observation he ``confirmed'' on
a hand calculator, and conjectured that these are all that exist.
I confirm that Beech's numbers are palintiples, I will show that they
are not all of the palintiples. I will show that the palintiples do
not form a regular language. And then I will prove that I have found
all the palintiples, by describing the them with a generalized form
of regular expression. The results become more interesting in other
bases.
First, I have a more reasonable method of confirming that these
numbers are palintiples:
Proof: First, letting "9*" and "0*" refer an arbitrary string of
nines and a string of zeroes of the same length, I note that
879*12 = 879*00 + 12 = (880*00 - 100) + 12 = 880*00 - 88
219*78 = 219*00 + 78 = (220*00 - 100) + 78 = 220*00 - 22
989*01 = 989*00 + 1 = (990*00 - 100) + 1 = 990*00 - 99
109*89 = 109*00 + 89 = (110*00 - 100) + 89 = 110*00 - 11
It is obvious that 4x(220*00 - 22) = 880*00 - 88 and that
9x(110*00 - 11) = 990*00 - 99. QED.
Now, to show that these palintiples are not all that exist, let us
take the (infinite) language L[4] = (879*12 + 0*), and let Pal(L[4])
refer to the set of palindromes over the alphabet L[4]. It is
immediate that the numbers in Pal(L[4]) are palintiples. For
instance,
8712 000 87912 879999912 879999912 87912 000 8712
= 4 x 2178 000 21978 219999978 219999978 21978 000 2178
(where I have inserted spaces to enhance readability) is a palintiple.
Similarly, taking L[9] = (989*01 + 0*), the numbers in Pal(L[9]) are
palintiples. We exclude numbers starting with zeroes.
The reason these do not form a regular language is that the
sub-palintiples on the left end of the number must be the same (in
reverse order) as the sub-palintiples on the right end of the number:
8712 8712 87999912 = 4 x 2178 2178 21999978
is not a palintiple, because 8712 8712 87999912 is not the reverse of
2178 2178 21999978. The pumping lemma can be used to prove that
Pal(L[4])+Pal(L[9]) is not a regular language, just as in the familiar
proof that the palindromes over a non-singleton alphabet do not form a
regular language.
Now to characterize all the palintiples, let N be a palintiple,
N=CxR(N), where R(.) signifies reversal, and C>1 is an integer. (I
use "x" for multiplication, to avoid confusion with the Kleene star
"*", which signifies the concatenated closure.) If D is a digit of N,
let D' refer to the corresponding digit of R(N). Since N=CxR(N),
D+10T = CxD'+S, where S is the carry in to the position occupied by D'
when R(N) is multiplied by C, and T is the carry out of that position.
Similarly, D'+10T'=CxD+S', where S', T' are carries in and out of the
position occupied by D when R(N) is multiplied by C.
Since D and D' are so closely related, I will use the symbol D:D' to
refer to a digit D on the left side of a string with a corresponding
digit D' on the right side of the string. More formally, an
expression "x[1]:y[1] x[2]:y[2] ... x[n]:y[n] w" will refer to a
string "x[1] x[2] ... x[n] w y[n] ... y[2] y[1]", where the x[i] and
y[i] are digits and w is a string of zero or one digits. So 989901
may be written as 9:1 8:0 9:9 and 87912 may be written as 8:2 7:1 9.
Thus Pal(L[4])+Pal(L[9]) (omitting numbers with leading zeroes) can be
represented as
(8:2 7:1 9:9* 1:7 2:8 0:0*)*
(0:0* + 0 + 8:2 7:1 ( 9:9* + 9:9* 9))
+ (9:1 8:0 9:9* 0:8 1:9 0:0*)*
(0:0* + 0 + 9:1 8:0 ( 9:9* + 9:9* 9)). (1)
For each pair of digits D:D', there are a very limited--and often
empty--set of quadruples S,T,S',T' of digits that satisfy the
equations
D +10T =CxD'+S
D'+10T'=CxD +S', (2)
yet such a quadruple must exist for "D:D'" to appear in a palintiple
with multiplier C. Furthermore, the S and T' of one D:D' must be T
and S', respectively, of the next pair of digits that appear. This
enables us to construct a finite state machine to recognize those
palintiples. The states [X#Y] refer to a pair of carries in D and D',
and we allow a transition from state [T#S'] to state [S#T'] on input
symbol D:D' exactly when equations (2) are satisfied. Special
transitions for a single-digit input symbol (the central digit of
odd-length palintiples) and the criteria for the initial and the
accepting states are left as exercises. The finite state machines
thus formed are